how to export functions with javascript